

//
//  ExercisesAnswerResultHeaderView.m
//  ShowYork
//
//  Created by hxh on 2020/9/12.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "ExercisesAnswerResultHeaderView.h"

@interface ExercisesAnswerResultHeaderView ()
@property (nonatomic,strong)UILabel *mainTitleLb;
@property (nonatomic,strong)UILabel *totalScoreLb;
@property (nonatomic,strong)UILabel *realScoreLb;
@end

@implementation ExercisesAnswerResultHeaderView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUI];
    }
    return self;
}
- (void)setUI{
    self.mainTitleLb = [[UILabel alloc]init];
    self.mainTitleLb.text = @"语言文字应用";
    self.mainTitleLb.textColor = RGBA(51, 51, 51, 1);
    self.mainTitleLb.font = font(14);
    [self addSubview:self.mainTitleLb];
    
    [self.mainTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self).offset(28);
        make.bottom.equalTo(self);
    }];
    
    
    self.totalScoreLb = [[UILabel alloc]init];
    self.totalScoreLb.text = @"/30分";
    self.totalScoreLb.textColor = C102;
    self.totalScoreLb.font = font(12);
    [self addSubview:self.totalScoreLb];

    [self.totalScoreLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mainTitleLb);
        make.right.mas_equalTo(self).offset(-28);
    }];
    
    self.realScoreLb = [[UILabel alloc]init];
    self.realScoreLb.text = @"16分";
    self.realScoreLb.textColor = C102;
    self.realScoreLb.font = font(14);
    [self addSubview:self.realScoreLb];
    
    [self.realScoreLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mainTitleLb);
        make.right.mas_equalTo(self.totalScoreLb.mas_left);
    }];
    
}

- (void)setAnswerResultTitle:(NSString *)title totalScore:(NSString *)totalScore realScore:(NSString *)realScore{
    self.mainTitleLb.text = title;
    self.totalScoreLb.text = [NSString stringWithFormat:@"/%@分",totalScore];
    self.realScoreLb.text = [NSString stringWithFormat:@"%@分",realScore];
}
- (void)setResultModel:(ExercisesPaperResultModel *)model atIndex:(NSInteger)index{
    ExercisesTitleModel *titleModel = model.paper.titleItems[index];
    self.mainTitleLb.text = titleModel.name;
    self.totalScoreLb.text = [NSString stringWithFormat:@"/%@分",titleModel.totalScore];
    self.realScoreLb.text = [NSString stringWithFormat:@"%@分",titleModel.realScore];

    
} 
@end
